/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package preprocessing;

import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.FileReader;
import java.io.FileWriter;
import weka.core.Instances;
import weka.filters.Filter;
import weka.filters.unsupervised.attribute.NumericToNominal;

/**
 *
 * @author Winzelric
 */
public class UnsupervisedDiscritize{
  Instances ins;
  
  public UnsupervisedDiscritize(Instances x) {
      ins = x;
  }
  
  public Instances returnInstances (Instances x) {
      String[] options = new String[2];
      //options[0] = "-R";                                    // "range"
      //options[1] = "1";                                     // first attribute
      NumericToNominal num = new NumericToNominal();             // new instance of filter
        try {
            //num.setOptions(options);                       // set options
            num.setInputFormat(x);
            ins = num.useFilter(x, num);
        } catch (Exception ex) {
        }
      return ins;
  }
}
